#include <stdio.h>
#include <stdlib.h>

#define kMaxSize 1001
typedef int Position; /* 整型下标，表示元素的位置 */
typedef struct StringNode *String;
struct StringNode {
    char data[kMaxSize]; /* 存储字符的数组 */
    int length; /* 字符串长度 */
};

String InitStr() {
    /* 初始化一个空的字符串 */
    String s;

    s = (String)malloc(sizeof(struct StringNode));
    s->length = 0;

    return s;
}

/* 算法4-4：字符串连接操作  StrConcat(s,t) */
void StrConcat(String s, String t) {
    int n, m;
    Position i;

    n = s->length;
    m = t->length;
    if ((n + m) < kMaxSize) { /* 若串接后不超长 */
        for (i = 0; i <= m; i++) { /* i=m处理结束符 */
            s->data[n + i] = t->data[i];
        }
        s->length = n + m;
    } else {
        printf("错误：连接将导致字符串长度超限。\n");
    }
}
/* 算法4-4 结束 */

String ReadString() {
    Position i;
    String s;

    s = InitStr(); /* 创建空的字符串 */
    i = 0;
    s->data[i] = getchar();
    while (s->data[i] != '\n') {
        i++;
        s->data[i] = getchar();
    }
    s->data[i] = '\0'; /* 字符串结束符占1位 */
    s->length = i;
    return s;
}

int main(void) {
    String s, t;

    s = ReadString();
    t = ReadString();
    StrConcat(s, t);
    printf("%s\n", s->data);

    return 0;
}